const sharp = require('sharp');
const fs = require('fs');
const path = require('path');

const svgDir = path.join(__dirname, 'static');
const svgFiles = fs.readdirSync(svgDir).filter(file => file.endsWith('.svg'));

svgFiles.forEach(async (svgFile) => {
    const svgPath = path.join(svgDir, svgFile);
    const pngPath = svgPath.replace('.svg', '.png');
    
    try {
        await sharp(svgPath)
            .resize(32, 32)
            .png()
            .toFile(pngPath);
        console.log(`Converted ${svgFile} to PNG`);
    } catch (error) {
        console.error(`Error converting ${svgFile}:`, error);
    }
});